package com.gitee.wsl.common.ui.draw.container

import androidx.compose.ui.geometry.Size
import com.gitee.wsl.common.ui.draw.api.Resizable


/**
 * A VizContainer allows to create superposed Viz with the sames size through the [newViz] function.
 *
 * The VizContainer is bound to a platform element (View for Android, Pane for JFX, Div for JS).
 *
 * The [size] of the VizContainer is synchronized with the size of its underlying platform element.
 * The VizContainer takes the size of the platform element when it's created. Later modification of size
 * must be done through the [size] property of the VizContainer (and not by modifying the underlying
 * platform element), the underlying platform size is then modified accordingly.
 *
 * A VizContainer is mandatory to create a chart. The VizContainer holds the charting visualization(s).
 * Depending on the configuration one chart can generate one or two visualizations to optimize
 * rendering performances.
 *
 * You can create a VizContainer from a platform element , using the [newVizContainer]
 * extension function.
 *
 * Linked to a platform element that can hold multiple canvas.
 */
 interface Container: Resizable {

    /**
     * Creates a new [Viz] inside the platform element.
     */
     fun newViz(init: Viz.() -> Unit = {}): Viz

    /**
     * All the viz created with [newViz].
     */
     val vizList: List<Viz>

    /**
     * The size of this [VizContainer], on change updates the underlying platform element and the existing canvas.
     */
     var size: Size

     val density: Double


}